From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0395.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0395.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0395.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0395.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0395.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0395.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0396.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0396.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0396.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0396.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0396.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0396.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0397.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0397.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0397.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0397.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0397.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0397.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0398.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0398.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0398.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0398.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0398.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0398.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0399.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0399.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0399.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0399.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0399.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0399.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0400.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0400.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0400.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0400.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0400.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0400.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0401.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0401.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0401.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0401.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0401.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0401.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0402.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0402.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0402.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0402.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0402.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0402.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0403.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0403.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0403.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0403.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0403.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0403.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0404.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0404.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0404.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0404.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0404.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0404.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0001.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0001.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0001.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0001.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0001.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0001.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0002.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0002.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0002.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0002.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0002.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0002.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0003.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0003.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0003.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0003.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0003.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0003.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0004.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0004.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0004.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0004.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0004.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0004.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0005.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0005.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0005.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0005.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0005.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0005.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0006.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0006.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0006.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0006.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0006.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0006.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0007.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0007.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0007.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0007.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0007.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0007.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0008.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0008.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0008.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0008.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0008.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0008.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0009.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0009.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0009.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0009.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0009.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0009.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0010.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0010.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0010.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0010.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0010.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0010.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0001.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0001.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0001.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0001.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0001.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0001.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0002.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0002.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0002.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0002.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0002.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0002.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0003.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0003.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0003.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0003.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0003.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0003.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0004.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0004.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0004.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0004.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0004.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0004.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0005.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0005.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0005.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0005.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0005.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0005.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0006.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0006.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0006.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0006.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0006.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0006.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0007.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0007.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0007.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0007.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0007.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0007.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0008.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0008.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0008.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0008.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0008.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0008.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0009.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0009.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0009.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0009.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0009.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0009.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0010.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0010.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0010.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0010.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0010.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0010.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0001.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0001.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0001.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0001.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0001.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0001.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0002.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0002.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0002.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0002.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0002.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0002.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0003.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0003.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0003.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0003.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0003.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0003.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0004.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0004.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0004.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0004.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0004.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0004.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0005.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0005.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0005.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0005.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0005.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0005.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0006.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0006.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0006.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0006.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0006.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0006.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0007.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0007.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0007.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0007.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0007.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0007.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0008.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051121/9f1296a5/attachment-0008.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0008.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0008.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0008.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0008.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0009.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0009.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0009.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0009.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0009.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0010.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0001.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0010.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0010.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0010.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0010.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0011.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0002.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0011.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0011.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0011.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0011.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0012.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0003.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0012.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0012.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0012.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0012.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0013.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0004.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0013.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0013.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0013.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0013.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0014.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0005.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0014.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0014.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0014.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0014.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0015.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0006.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0015.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0015.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0015.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0015.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0016.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0007.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0016.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0016.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0016.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0016.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0017.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0008.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0017.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0017.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0017.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0017.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0018.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0009.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0018.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0018.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0018.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0018.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0019.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0010.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0019.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0019.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0019.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0019.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0020.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0011.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0020.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0020.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0020.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0020.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0021.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0012.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0021.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0021.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0021.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0021.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0022.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0013.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0022.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0022.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0022.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0022.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0023.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0014.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0023.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0023.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0023.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0023.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0024.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0015.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0024.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0024.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0024.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0024.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0025.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0016.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0025.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0025.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0025.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0025.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0026.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0017.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0026.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0026.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0026.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0026.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0027.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0018.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0027.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0027.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0027.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0027.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0028.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0019.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0028.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0028.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0028.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0028.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0029.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0020.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0029.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0029.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0029.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0029.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0030.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0021.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0030.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0030.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0030.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0030.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0031.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw@geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0022.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0031.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0031.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0031.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0031.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0032.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0023.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0032.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0032.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0032.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0032.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0033.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0024.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0033.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0033.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0033.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0033.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0034.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0025.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0034.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0034.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0034.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0034.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0035.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0026.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0035.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0035.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0035.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0035.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0036.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0027.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0036.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0036.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0036.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0036.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0037.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0028.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0037.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0037.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0037.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0037.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0038.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0029.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0038.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0038.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0038.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0038.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0039.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0030.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0039.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0039.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0039.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0039.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0040.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0031.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0040.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0040.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0040.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0040.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0041.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0032.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0041.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0041.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0041.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0041.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0042.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0033.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0042.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0042.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0042.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0042.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0043.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0034.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0043.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0043.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0043.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0043.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0044.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0035.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0044.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0044.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0044.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0044.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0045.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0036.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0045.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0045.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0045.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0045.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0046.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0037.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0046.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0046.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0046.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0046.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0047.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0038.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0047.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0047.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0047.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0047.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0048.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0039.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0048.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0048.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0048.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0048.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0049.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0040.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0049.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0049.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0049.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0049.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0050.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0041.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0050.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0050.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0050.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0050.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0051.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0042.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0051.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0051.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0051.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0051.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0052.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An int describing a flow control * type. * @return A String describing a flow control type. */ String flowToString(int flowControl) { switch (flowControl) { case SerialPort.FLOWCONTROL_NONE: return "None"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "Xon/Xoff Out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "Xon/Xoff In"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "RTS/CTS In"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "RTS/CTS Out"; default: return "None"; } } } Then, the GUI should be rather simpler to write...here is a first stab: import gui.ClosableJFrame; import gui.layouts.DialogLayout; import serialPort.CommPortUtils; import javax.swing.*; import java.awt.*; public abstract class RunSerialPortPanel extends JPanel implements Runnable { private SerialPortBean serialPortBean = SerialPortBean.restore(); public RunSerialPortPanel() { init(); } private void init() { setLayout(new BorderLayout()); add(getSerialPanel(), BorderLayout.CENTER); add(getButtonPanel(), BorderLayout.SOUTH); } private JPanel getSerialPanel() { JPanel jp = new JPanel(); jp.setLayout(new DialogLayout()); jp.add(new JLabel("Port:")); CommPortUtils cpu = CommPortUtils.getCommPortUtils(); if (cpu == null) return jp; RunComboBox cb = new RunComboBox(cpu.getCommPortNames()) { public void run() { final String name1 = (String) getSelectedItem(); if (name1 == null) return; serialPortBean.setPortName(name1); } }; final String serialPortName = serialPortBean.getPortName(); if (serialPortName != null) cb.setSelectedItem(serialPortName); jp.add(cb); jp.add(new JLabel("baud:")); cb = new RunComboBox(cpu.getBaudRates()) { public void run() { final Integer br = (Integer) getSelectedItem(); if (br == null) return; serialPortBean.setBaudRate(br.intValue()); } }; cb.setSelectedItem(new Integer(serialPortBean.getBaudRate())); jp.add(cb); return jp; } public SerialPortBean getValue() { return serialPortBean; } private JPanel getButtonPanel() { JPanel jp = new JPanel(); jp.setLayout(new FlowLayout()); jp.add( new RunButton("ok") { public void run() { doOk(); } }); return jp; } private void doOk() { serialPortBean.save(); this.run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame(); Container c = cf.getContentPane(); c.add( new RunSerialPortPanel() { public void run() { System.out.println(getValue()); cf.pack(); } }); cf.pack(); cf.setVisible(true); } } Where the RunComboBox uses the command pattern to map the listener into the run method (I do this will all my widgets): import gui.ClosableJFrame; import gui.In; import gui.layouts.Alignable; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; public abstract class RunComboBox extends JComboBox implements ActionListener, Alignable, Runnable { private int alignment = Alignable.CENTER; public void setAlignment(int alignment) { this.alignment = alignment; } public int getAlignment() { return alignment; } public RunComboBox(Object items[]) { super(items); addActionListener(this); } public RunComboBox(Vector items) { super(items); addActionListener(this); } public int getValue() { return getSelectedIndex(); } public void actionPerformed(ActionEvent e) { run(); } public static void main(String[] args) { final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new FlowLayout()); Vector v = new Vector(); v.addElement(new Commando("foo") { public void run() { In.message("you selected foo!"); } }); v.addElement(new Commando("fee") { public void run() { In.message("you selected fee!"); } }); v.addElement(new Commando("wow") { public void run() { In.message("you selected wow!"); } }); c.add(new RunComboBox(v) { public void run() { Runnable r = (Runnable) this.getSelectedItem(); r.run(); } }); cf.setSize(200, 200); cf.setVisible(true); } public static void test1() { // anonymous inner class // That uses the command pattern // also uses adapter pattern // since the normal // requires an // actionListener- // actionPerformed(ActionEvent e) // now we just need a run method. // Semantics for the runButton now include // an implicit metaChar='[' final ClosableJFrame cf = new ClosableJFrame("OK-CANCEL Frame"); final Container c = cf.getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); Vector v = new Vector(); v.addElement("tom"); v.addElement("dick"); v.addElement("harry"); c.add(new RunComboBox(v) { public void run() { System.out.println(this.getSelectedItem()); c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.LINE_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS)); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); cf.pack(); } }); c.add(new RunComboBox(v) { public void run() { c.setLayout(new FlowLayout()); cf.pack(); } }); cf.setSize(200, 200); cf.setVisible(true); } } From x.frisaye at t4hr.com Mon Nov 21 00:21:23 2005 From: x.frisaye at t4hr.com (Xavier Frisaye) Date: Mon, 21 Nov 2005 08:21:23 +0100 Subject: [Rxtx] rxtx vs comm.jar Message-ID: Hi everybody, I'm asking one question : What are the benefits and/or the disadvantages to use rxtx instead of sun windows comm.jar + dll? Assuming that my application will always run on a windows system. Thanks for replying, Regards Xavier Frisaye From dacker at nomadio.net Mon Nov 21 10:23:00 2005 From: dacker at nomadio.net (David S. Acker) Date: Mon, 21 Nov 2005 12:23:00 -0500 Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: Message-ID: <001101c5eec0$392a9270$6901a8c0@wildfire> I made the switch because sun's comm didn't handle ports that come and go like USB based serial ports. It seemed to read the list at load time and without doing a custom class loader it couldn't handle USB serial ports that are added after the class was loaded. RxTx handles it perfectly. Also, you get full source to RxTX so if you have an issue you can go in and make and submit patches. Meanwhile, the sun one is totally unsupported. I put a few windows related patches in myself that are now in the standard release. -Ack > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] > On Behalf Of Xavier Frisaye > Sent: Monday, November 21, 2005 2:21 AM > To: rxtx at qbang.org > Subject: [Rxtx] rxtx vs comm.jar > > Hi everybody, > > I'm asking one question : > What are the benefits and/or the disadvantages to use rxtx > instead of sun windows comm.jar + dll? > Assuming that my application will always run on a windows system. > > Thanks for replying, > > Regards > > Xavier Frisaye > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tjarvi at qbang.org Mon Nov 21 13:13:38 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 21 Nov 2005 13:13:38 -0700 (MST) Subject: [Rxtx] rxtx vs comm.jar In-Reply-To: <001101c5eec0$392a9270$6901a8c0@wildfire> References: <001101c5eec0$392a9270$6901a8c0@wildfire> Message-ID: On Mon, 21 Nov 2005, David S. Acker wrote: > I made the switch because sun's comm didn't handle ports that come and go > like USB based serial ports. It seemed to read the list at load time and > without doing a custom class loader it couldn't handle USB serial ports that > are added after the class was loaded. RxTx handles it perfectly. Also, you > get full source to RxTX so if you have an issue you can go in and make and > submit patches. Meanwhile, the sun one is totally unsupported. I put a few > windows related patches in myself that are now in the standard release. > -Ack The one disadvantage is the complete commapi in rxtx is in package gnu.io not javax.com to avoid confusion with Sun's namespace. There are also some features not supported in rxtx such as buffering (use a buffered output stream instead). It isnt clear how much of what was suggested as an API is implemented by Sun either. They should both be usable. There are bits in rxtx 2.1 which never made it into Sun's specification. From pashmina.mukhi at patni.com Mon Nov 21 23:57:28 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Tue, 22 Nov 2005 12:27:28 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem Message-ID: Hi, I am using the rxtx api for serial communication. We have multiple requests running and a set of 8 modems on which these requests can be run. The issue faced is that, even after the Serial Port is released, via the close(), and the next request is processed on the same modem, the ownership of the port remains with the previous request that had opened it. I believed that closing the port would release the ownership of the port. I am also making the Serial Port object null after closing it, and introducing some sleep time, but that does not help. Does anyone have an idea, what needs to be done, so as to completely release the ownership of the modem? Thanks in advance. Regards, Pashmina Mukhi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051122/9f1296a5/attachment-0043.html From tjarvi at qbang.org Tue Nov 22 11:30:07 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 22 Nov 2005 11:30:07 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From pbarthelemy at aim.com Tue Nov 22 12:00:58 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Tue, 22 Nov 2005 20:00:58 +0100 Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: Hi, I'll try to build something in the coming weeks on the subject, maybe based on BlackBox and on Mr. Lyon post. I'll keep you posted... --p Le 18 nov. 05 ? 18:47, Trent Jarvi a ?crit : > On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > >> Hi, >> >> As part of the Swing test/demo application I mentionned earlier, >> I'm looking for a configuration UI for rxtx. >> something like a JFrame-based component with nice comboboxes, drop- >> down lists, etc... to set all the parameters of the serial ports. >> >> I've googled for this, and I did not find anything ( altough, I >> thought I have seen such a thing somewhere before ) >> >> Can anybody point me to such a configuration UI ? >> > > Hi Philippe, > > There has been talk of doing something like this but I've not heard > of anything materializing yet. Many would like to do a swing type > application that does much like the serial blackbox demo that comes > with commAPI. The problems with blackbox include > > 1) It is crusty (umaintained?) AWT code. > 2) There are limitations in the hard coded defaults that do not > apply to rxtx. In fact they cause problems. > 3) It can not be distributed with RXTX because of licensing issues. > > Some have thought about doing something in Swing which would be > OK. The swing API is mature. Another interesting idea would be to > do the same thing with SWT. This is a simple API which is > implemented in Open Source. > > The SWT is not as large and complete as Swing but it would allow us > to compile native applications for testing that would run on > machines even if there are Java install problems. It is possibly > something OS vendors could include with their distribution if it > goes well enough. The native applications would simply be build > using gcj. The GNU compiler. The code would work in Java as well. > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From pashmina.mukhi at patni.com Wed Nov 23 21:41:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Thu, 24 Nov 2005 10:11:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Thanks for the reply Trent. I am using rxtx 2.1 version, on a Linux system. While processing, I checked the /var/lock directory. The LCK file for the particular modem was deleted, when the port was closed. However, when a new request was processed on the same port, the ownership of port was still linked to the previous request. Also I am introducing some sleep time after closing the port, so that there would be some gap before the next request is processed. You mentioned disabling the lock files. Where would I need to make the entry for this? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Wednesday, November 23, 2005 12:00 AM To: pashmina.mukhi at patni.com; RXTX Developers and Users Subject: Re: [Rxtx] Releasing Serial Port and Ownership of the modem On Tue, 22 Nov 2005, Pashmina Mukhi wrote: > Hi, > > I am using the rxtx api for serial communication. We have multiple requests > running and a set of 8 modems on which these requests can be run. > > The issue faced is that, even after the Serial Port is released, via the > close(), and the next request is processed on the same modem, the ownership > of the port remains with the previous request that had opened it. > I believed that closing the port would release the ownership of the port. I > am also making the Serial Port object null after closing it, and introducing > some sleep time, but that does not help. > > Does anyone have an idea, what needs to be done, so as to completely release > the ownership of the modem? > With rxtx 2.0, the port ownership is handled by Sun's commapi. I don't think we can do anything to change it. With rxtx 2.1, port ownership is not really performed. A lockfile is created which prevents other applications from opening the port. Closing the port should delete the lockfile (in /var/lock or like directories depending upon the OS) in Unix like systems. Windows does not use lockfiles. With windows just trying to open the port twice without a close will cause an error as I recall. You could try rxtx configured with --disable-lockfiles in 2.1 to see if it is a lockfile problem. As you can see, we need a little more information to know what the problem is. From tjarvi at qbang.org Wed Nov 23 21:50:55 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 23 Nov 2005 21:50:55 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> References: <5CD1FEA959564653A027540DB72DBF1B@ttcnt.com> Message-ID: On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From pashmina.mukhi at patni.com Fri Nov 25 02:58:29 2005 From: pashmina.mukhi at patni.com (Pashmina Mukhi) Date: Fri, 25 Nov 2005 15:28:29 +0530 Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: Message-ID: Hi Trent, The strange situation that I am facing (of ownership of port still being linked to the previous request) does not happen all the time. Via the code, I ran a couple of requests on the first modem (opening the port for an application, getting processed, closing the port and going onto the next request/application). Here the requests executed properly, without the mixup of ownership. However, simultaneously if I am processing a request on another modem, the mixup of port ownership occurs. Does this make sense or provide some clue as to why this could be occurring? Regards, Pashmina Mukhi -----Original Message----- From: Trent Jarvi [mailto:tjarvi at qbang.org] Sent: Thursday, November 24, 2005 10:21 AM To: Pashmina Mukhi Cc: 'Trent Jarvi'; 'RXTX Developers and Users' Subject: RE: [Rxtx] Releasing Serial Port and Ownership of the modem On Thu, 24 Nov 2005, Pashmina Mukhi wrote: > Thanks for the reply Trent. > > I am using rxtx 2.1 version, on a Linux system. > > While processing, I checked the /var/lock directory. The LCK file for the > particular modem was deleted, when the port was closed. However, when a new > request was processed on the same port, the ownership of port was still > linked to the previous request. > > Also I am introducing some sleep time after closing the port, so that there > would be some gap before the next request is processed. > > You mentioned disabling the lock files. Where would I need to make the entry > for this? > Strange. I don't think there is any logic in rxtx 2.1 beyond the lockfiles that would prevent ports from opening. To be honest I didnt understand what Sun was trying to do when I schetched in that code so just fudged over it. It turns out not very many people are interested in sharing the ports like that but there are some. You can try to disable lockfiles by recompiling rxtx. tar -xf rxtx-2.1...tar.gz mkdir rxtx-2.1.../build cd rxtx-2.1.../build ../configure --disable-lockfiles make or make install I would not use it for anything more than testing. If you ever open the port with two different applications and try to debug what is happening to your 'lost' data, you will wish you never disabled locked files. Perhaps another thing that could be happening since you mention modem is a lockfile is still in place for a device that is symblic linked. /dev/modem => /dev/ttyS3 for instance. Either device file could be locked and rxtx should respect the lockfile in either case. From tjarvi at qbang.org Fri Nov 25 11:04:19 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 25 Nov 2005 11:04:19 -0700 (MST) Subject: [Rxtx] Releasing Serial Port and Ownership of the modem In-Reply-To: References: Message-ID: On Fri, 25 Nov 2005, Pashmina Mukhi wrote: > Hi Trent, > > The strange situation that I am facing (of ownership of port still being > linked to the previous request) does not happen all the time. > > Via the code, I ran a couple of requests on the first modem (opening the > port for an application, getting processed, closing the port and going onto > the next request/application). Here the requests executed properly, without > the mixup of ownership. > > However, simultaneously if I am processing a request on another modem, the > mixup of port ownership occurs. Does this make sense or provide some clue as > to why this could be occurring? > When Modems are enumerated, rxtx attempts to lock and unlock every single serial port before trying a a timed out read. So I could picture a problem if you are enumerating more than once but that is about it. If you are not seeing lockfiles left around, I can't think of anything in rxtx code that would be playing games with ownership. I have seen instances where rxtx has left lockfiles because the port was not closed when a program quit. The next program to find the lockfile with rxtx will note that the lockfile is owned by a dead process and will remove it. From brian at mbari.org Tue Nov 29 14:48:25 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 13:48:25 -0800 Subject: [Rxtx] Java Comm for Windows is gone Message-ID: <84FD69F5-1069-4ED6-A7F8-883600993B67@mbari.org> Hi All, Just a heads up that Sun has removed the links to Java Comm for Windows from their web site. Sun now provides Java Comm version 3.0 for Solaris and Linux. This is going to upset a few developers (like myself) who have applications that depend on the javax.comm namespace. There's a couple of threads about it at: http://forum.java.sun.com/thread.jspa?threadID=680756&tstart=0 http://swforum.sun.com/jive/thread.jspa?threadID=59439 Trent has pointed out that Sun's license on Java Comm prohibits other software from using the javax.comm namespace. So the question is: What do folks recommend as a workaround? A few options I see are: 1) Petition Sun to let other use the javax.comm names space 2) Test to see if the comm.jar from the javacomm version 3.0 works with RXTX 2.0.x 3) Recommend porting applications to gnu.io namespace. (Not necessarily my favorite) Others? Anyway, I expect RXTX will be getting more traffic because of this. Cheers B Brian Schlining Software Engineer http://www.mbari.org From brian at mbari.org Tue Nov 29 15:03:00 2005 From: brian at mbari.org (Brian Schlining) Date: Tue, 29 Nov 2005 14:03:00 -0800 Subject: [Rxtx] (no subject) Message-ID: Hi All, I've been trying to use rxtx in an application that controls professional VCRs. My app runs fine with Sun's java comm on Windows. However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error: java.lang.IllegalMonitorStateException: current thread not owner at java.lang.Object.wait(Native Method) at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java: 65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:233) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:104) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getVcrConnectionPa nel(ConnectionDialog.java:89) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJPanel (ConnectionDialog.java:140) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.getJContentPane (ConnectionDialog.java:122) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog.initialize (ConnectionDialog.java:152) at org.mbari.vars.annotation.ui.dialogs.ConnectionDialog. (ConnectionDialog.java:47) at org.mbari.vars.annotation.ui.actions.OpenConnectionsAction. (OpenConnectionsAction.java:34) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getMyMenuBar (AnnotationAppFrame.java:337) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:577) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:145) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:122) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$2.run (AnnotationApp.java:195) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java: 189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) This is not an intermittent error. I can get it to occur everytime I run the code. The code need to run this can be found at http:// dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons- logging.jar need to run a test application. The vcr_src.jar contains the source code for the application. To run it: 1) Save the 2 jars to a directory 2) Open a terminal and run the command 'java -cp ./commons- logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. 3) A VCR control will open. Select the menu 'File->Connect to VCR' 4) A dialog with all the serial ports will pop up. Select from the list an click OK. 5) The Stack trace will appear in the terminal with an IllegalMonitorStateException. All the source code for the VCR control can be found in CVS at http:// sourceforge.net/cvs/?group_id=151101. Any ideas or suggestions? Thanks B Brian Schlining Software Engineer http://www.mbari.org From tjarvi at qbang.org Tue Nov 29 20:01:12 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 29 Nov 2005 20:01:12 -0700 (MST) Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: On Tue, 29 Nov 2005, Brian Schlining wrote: > Hi All, > > I've been trying to use rxtx in an application that controls professional > VCRs. My app runs fine with Sun's java comm on Windows. However when I run it > on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following > error: > > java.lang.IllegalMonitorStateException: current thread not owner > at java.lang.Object.wait(Native Method) > at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:329) > at org.mbari.comm.CommUtil.getAvailableSerialPorts(CommUtil.java:65) > > This is not an intermittent error. I can get it to occur everytime I run the > code. The code need to run this can be found at http:// > dods.mbari.org/brian/pub/vcr. You need vcr.jar and commons-logging.jar need > to run a test application. The vcr_src.jar contains the source code for the > application. To run it: > 1) Save the 2 jars to a directory > 2) Open a terminal and run the command 'java -cp ./commons- > logging.jar:./vcr.jar org.mbari.vcr.ui.VCRApp'. > 3) A VCR control will open. Select the menu 'File->Connect to VCR' > 4) A dialog with all the serial ports will pop up. Select from the > list an click OK. > 5) The Stack trace will appear in the terminal with an > IllegalMonitorStateException. > > All the source code for the VCR control can be found in CVS at http:// > sourceforge.net/cvs/?group_id=151101. > > Any ideas or suggestions? > The stack trace is suggesting that it is happening in Sun's code. A wait like shown or a notify(All) is what would trigger it. I'm not seeing how rxtx could be causing the problem. open() in RXTXPort.java is synchronized is it possible that's resulting in a change of monitor ownership? From lyon at docjava.com Wed Nov 30 00:26:56 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 30 Nov 2005 02:26:56 -0500 Subject: [Rxtx] mac serial ports Message-ID: Recently, Brian Schlining writes: "... However when I run it on Mac OS X using RXTX 2.0.7 (installed using fink) I get the following error:..." When you run: http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Do you get a serial port error when you go to the serial port set-up? I have checked the software with the Griffin Serial Card, for the Mac Cube, Port IO and the KeySpan 19HS. All seem to work..so far. Thanks! - Doug From mringwal at inf.ethz.ch Wed Nov 30 02:16:11 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 10:16:11 +0100 Subject: [Rxtx] (no subject) In-Reply-To: References: Message-ID: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> hi Trent, Brian On 30.11.2005, at 04:01, Trent Jarvi wrote: > The stack trace is suggesting that it is happening in Sun's code. you mean its is in the javax.comm package. thanks for pointing this out. the fink version is using the gnu classpathx javax.comm implementation. (which btw was my choice of dealing with sun's licensing issues) brian, you could try out to replace /sw/share/java/classpathx-comm/ by the one from Sun's website and report back? Cheers, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/525bd9de/attachment-0052.html From brian at mbari.org Wed Nov 30 09:42:04 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 08:42:04 -0800 Subject: [Rxtx] mac serial ports In-Reply-To: References: Message-ID: Hi Doug > "... > However when I run it on Mac OS X using RXTX 2.0.7 (installed using > fink) I get the following error:..." > When you run: > http://show.docjava.com:8086/book/cgij/code/jnlp/ > addbk.JAddressBook.Main.jnlp > Do you get a serial port error when you go to the serial port set-up? Does you app use RXTX 2.1 (gnu.io namespace)? The VCR App uses RXTX 2.0 (javax.comm namespace). When I try to run JAddressBook I get: java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver > I have checked the software with the Griffin Serial Card, > for the Mac Cube, Port IO and the KeySpan 19HS. All seem to > work..so far. The RXTX I was using works for certain things. For example I can use it to talk to a GPS with no problem. It's just in this particular application (the VCR control) I get an error with RXTX but not with Java Comm. My Platform is Power Mac G5/ OS X 10.4.3 using a IOGear GUC232A USB-Serial Adapter. Brian Schlining Software Engineer http://www.mbari.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/82940a4b/attachment-0052.html From brian at mbari.org Wed Nov 30 10:27:58 2005 From: brian at mbari.org (Brian Schlining) Date: Wed, 30 Nov 2005 09:27:58 -0800 Subject: [Rxtx] (no subject) In-Reply-To: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> Message-ID: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> HI Matthias, >> The stack trace is suggesting that it is happening in Sun's code. >> > > you mean its is in the javax.comm package. thanks for pointing this > out. > the fink version is using the gnu classpathx javax.comm > implementation. > (which btw was my choice of dealing with sun's licensing issues) > > brian, you could try out to replace /sw/share/java/classpathx-comm/ > by the one from Sun's website and report back? Same error using comm.jar from Java Comm 2.0 for Solaris. I've verified the classpath so I'm sure I'm using the jar that I think I am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It gave me: javax.comm: Can't find javax.comm.properties! java.io.IOException: javax.comm: platform driver class name = null (Check 'driver' property in javax.comm.properties) at javax.comm.CommPortIdentifier.loadDriver (CommPortIdentifier.java:244) at javax.comm.CommPortIdentifier. (CommPortIdentifier.java:109) at org.mbari.comm.CommUtil.getAvailableSerialPorts (CommUtil.java:65) at org.mbari.vcr.ui.VCRConnectionPanel.setSerialPorts (VCRConnectionPanel.java:213) at org.mbari.vcr.ui.VCRConnectionPanel. (VCRConnectionPanel.java:91) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.getVcrConnectio nPanel(VcrConnectionDialog.java:67) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog.initialize (VcrConnectionDialog.java:85) at org.mbari.vars.annotation.ui.dialogs.VcrConnectionDialog. (VcrConnectionDialog.java:56) at org.mbari.vars.annotation.ui.StatusLabelForVcr$1. (StatusLabelForVcr.java:68) at org.mbari.vars.annotation.ui.StatusLabelForVcr. (StatusLabelForVcr.java:56) at org.mbari.vars.annotation.ui.StatusPanel.getVcrLabel (StatusPanel.java:101) at org.mbari.vars.annotation.ui.StatusPanel.initialize (StatusPanel.java:130) at org.mbari.vars.annotation.ui.StatusPanel. (StatusPanel.java:60) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getStatusPanel (AnnotationAppFrame.java:409) at org.mbari.vars.annotation.ui.AnnotationAppFrame.getBottomPanel (AnnotationAppFrame.java:156) at org.mbari.vars.annotation.ui.AnnotationAppFrame.initialize (AnnotationAppFrame.java:490) at org.mbari.vars.annotation.ui.AnnotationAppFrame. (AnnotationAppFrame.java:120) at org.mbari.vars.annotation.ui.AnnotationApp.getAnnotationAppFrame (AnnotationApp.java:94) at org.mbari.vars.annotation.ui.AnnotationApp.initialize (AnnotationApp.java:150) at org.mbari.vars.annotation.ui.AnnotationApp. (AnnotationApp.java:80) at org.mbari.vars.annotation.ui.AnnotationApp$3.run (AnnotationApp.java:214) at java.awt.event.InvocationEvent.dispatch (InvocationEvent.java:189) at java.awt.EventQueue.dispatchEvent(EventQueue.java:478) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:234) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:178) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:170) at java.awt.EventDispatchThread.run(EventDispatchThread.java: 100) I'm under a bit of a time crunch with this. I'm giving a workshop on this software (http://vars.sourceforge.net) in about 2 weeks and it's really frustrating that Sun 'disappeared' the Java Comm libraries it needs. I think I'm going to switch this particular app over to the gnu.io namespace and see if it works. Cheers B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining MBARI Software Engineer brian at mbari.org (831)775-1855 http://www.mbari.org/staff/brian -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/4185f74b/attachment-0052.html From mringwal at inf.ethz.ch Wed Nov 30 10:34:57 2005 From: mringwal at inf.ethz.ch (Matthias Ringwald) Date: Wed, 30 Nov 2005 18:34:57 +0100 Subject: [Rxtx] (no subject) In-Reply-To: <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> References: <5FD1B234-90DC-4A04-9473-F87A0CA086A0@inf.ethz.ch> <93903578-3BA1-4901-965B-09ADD1BFA0B3@mbari.org> Message-ID: Hi Brian, I'm sorry, this didn't help. I'm not using rxtx really, but used it one or twice and didn't like the complicated installation of suns comm etc and setting up directories and users, so I set out to provide a fink package. If someone finds out, what to fix, I'll adapt the package. trying gnu.io could be worth a try. Matthias On 30.11.2005, at 18:27, Brian Schlining wrote: > HI Matthias, > >>> The stack trace is suggesting that it is happening in Sun's code. >>> >> >> you mean its is in the javax.comm package. thanks for pointing >> this out. >> the fink version is using the gnu classpathx javax.comm >> implementation. >> (which btw was my choice of dealing with sun's licensing issues) >> >> brian, you could try out to replace /sw/share/java/classpathx-comm/ >> by the one from Sun's website and report back? > > Same error using comm.jar from Java Comm 2.0 for Solaris. I've > verified the classpath so I'm sure I'm using the jar that I think I > am. Hmmm. I tried using Java Comm 3.0 too but that didn't work. It > gave me: > > javax.comm: Can't find javax.comm.properties! > > java.io.IOException: javax.comm: platform driver class name = null -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051130/241a5009/attachment-0052.html From halbleib at rechnerbetriebsgruppe.de Sun Nov 6 08:52:26 2005 From: halbleib at rechnerbetriebsgruppe.de (Tom Halbleib) Date: Sun, 06 Nov 2005 15:52:26 -0000 Subject: [Rxtx] Install In-Reply-To: References: Message-ID: <436E26C6.4090909@rechnerbetriebsgruppe.de> hi all, is there a manual for mac osx tiger too? cheers tom From phil_ren at hotmail.com Fri Nov 4 08:38:31 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Fri, 04 Nov 2005 15:38:31 +0000 Subject: [Rxtx] Install In-Reply-To: Message-ID: Greetings all, I'm very new at java...and even more so to this new library of yours...I have a project that requires me to communicate with a parallele port. I currently have your livrary in my /home/phil directory... I'm having difficulty installing it with the rest of my JDK platform.. I'm operating with Linux and I was wondering if you had a more detailed intallation procedure? To make the file can I simply use gcc -O filename rxtx-2.1-7pre17-i686-pc-linux-gnu? Much appreciated for all the help Cheers Phil From tjarvi at qbang.org Fri Nov 4 11:28:31 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 4 Nov 2005 11:28:31 -0700 (MST) Subject: [Rxtx] Install In-Reply-To: References: Message-ID: On Fri, 4 Nov 2005, Philippe Reynolds wrote: > > Greetings all, > > I'm very new at java...and even more so to this new library of yours...I have > a project that requires me to communicate with a parallele port. > > I currently have your livrary in my /home/phil directory... > I'm having difficulty installing it with the rest of my JDK platform.. > I'm operating with Linux and I was wondering if you had a more detailed > intallation procedure? > > To make the file can I simply use gcc -O filename > rxtx-2.1-7pre17-i686-pc-linux-gnu? > > Much appreciated for all the help > > Cheers > Phil > > For Linux as root with the src tar file tar -xzf rxtx-2.1... cd rxtx 2.1.. mkdir build cd build ../configure make install Then read about lockfiles (add the user to group lock) That should be it. From phil_ren at hotmail.com Mon Nov 7 11:22:11 2005 From: phil_ren at hotmail.com (Philippe Reynolds) Date: Mon, 07 Nov 2005 18:22:11 +0000 Subject: [Rxtx] tutorial In-Reply-To: Message-ID: Hi, I've now installed rxtx successfully...however I was hunting for a few tutorials that uses this library. Could anyone point me in the right direction? Cheers, and always much appreciated Phil From pbarthelemy at aim.com Mon Nov 7 14:59:23 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 22:59:23 +0100 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: > I've now installed rxtx successfully...however I was hunting for a > few tutorials that uses this library. Could anyone point me in the > right direction? > Hi, I wrote this : http://pbarthelemy.blogspirit.com/archive/2005/10/02/ rxtxswingdemoforj2se14-rxtx-org-swing-sample.html the starting point of this was : how should I use a progress bar to give users a feedback on a ongoing transfer ? It complexified into a GUI & test app for heartbit, my Polar HRM watch interface project ( runners knows what I am talking about ) The test app is stalled, partly because of my carpal tunnel syndrome ( it hurts ), partly because I tested about everything to get rxtx to work it my app, without success. your contribution is welcomed ! as for heartbit : I've lost its website in the sourceforge.net database migration : an very old version of the site is available at http://heartbit.sourceforge.net/index.old.html. It is not current, but you'll get the overview of my project regards, --Philippe From pbarthelemy at aim.com Mon Nov 7 15:02:35 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Mon, 7 Nov 2005 23:02:35 +0100 Subject: [Rxtx] debug flags at run time ? Message-ID: Hi, While I am at writing on rxtx : My understanding of the code is that the debug boolean used to enable logging are hard-coded in every classes. Is that correct ? Why not make them settable at runtime, i would ease debug, no ? regards, --philippe From christopher.dawes at ants.me.uk Mon Nov 7 16:10:50 2005 From: christopher.dawes at ants.me.uk (Christopher Dawes) Date: Mon, 07 Nov 2005 23:10:50 +0000 Subject: [Rxtx] debug flags at run time ? In-Reply-To: References: Message-ID: <1131405050.2667.5.camel@cdesk2.ants.me.uk> Making them settable at runtime is nice, however it leads to more inefficient code. At the best of times Java is not exactly lightning speed and if you are running on a low end system with java (I'm talking 400MHz and that's pretty high for a lot of businesses I work with) I've had problems with blocking IO and/or dropped messages when communicating at higher baud rates so having un-finalized constants could cause a lot of problems. What would be really nice might be the possibility of having Log4J used inside of a static final if condition. This would mean the compilation would strip out any non-debug statements for production code however leave different levels of granularity of debugging for people attempting to debug/develop code. Kind Regards Christopher On Mon, 2005-11-07 at 23:02 +0100, Philippe Barthelemy wrote: > Hi, > > While I am at writing on rxtx : > > My understanding of the code is that the debug boolean used to enable > logging are hard-coded in every classes. > Is that correct ? > > Why not make them settable at runtime, i would ease debug, no ? > > regards, > --philippe > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From roberto.tavares at gmail.com Tue Nov 8 03:58:40 2005 From: roberto.tavares at gmail.com (Roberto Tavares) Date: Tue, 8 Nov 2005 08:58:40 -0200 Subject: [Rxtx] tutorial In-Reply-To: References: Message-ID: <8d442b380511080258y555e6f61p@mail.gmail.com> Well, I got a shot quick start in Portuguese... with a simple example: http://www.tavares.eng.br/modules/edito/edito.php?idedito=8 The google translated version is: http://translate.google.com/translate?u=http%3A%2F%2Fwww.tavares.eng.br%2Fmodules%2Fedito%2Fedito.php%3Fidedito%3D8&langpair=pt%7Cen&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools Cheers, Roberto 2005/11/7, Philippe Reynolds : > > Hi, > > I've now installed rxtx successfully...however I was hunting for a few > tutorials that uses this library. Could anyone point me in the right > direction? > > Cheers, and always much appreciated > Phil > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20051108/db2333b2/attachment-0053.html From d.tonhofer at m-plify.com Tue Nov 15 07:13:11 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Tue, 15 Nov 2005 15:13:11 +0100 Subject: [Rxtx] Equinox SST-4P serial card installation hints Message-ID: <8C00667668EAD561279F6255@[192.168.1.7]> Hello, Just a note for those who shall try to install an Equinox board (in this case "SST-4P/LP") and try to run it with RXTX under Linux (in this case, Red Hat ES 4): The Equinox board makes the serial ports available as the device files /dev/ttyQ1a1 ... /dev/ttyQ1a4 You have to: 1) Modify the "eqnx" startup script "/etc/rc.d/init.d/eqnx" and make it set the permissions of the devices files in the 'start' section, immediately after the call to "ssmkn" (make device nodes): # create device files /usr/bin/ssmkn # fix rights on device files LIST=`ls /dev/ttyQ*` for DEV in $LIST; do chown root.uucp $DEV chmod 660 $DEV done 2) Modify src/RXTXCommDriver.java in the RXTX distribution. Add the "ttyQ1a" radical to the list of port radicals to check: if(osName.equals("Linux")) { String[] Temp = { "ttyS", // linux Serial Ports "ttySA", // for the IPAQs "ttyUSB", // for USB frobs "ttyQ1a" // Equinox }; CandidatePortPrefixes=Temp; } Then recompile and reinstall. From richardw at geoquip-rnd.demon.co.uk Tue Nov 15 07:14:03 2005 From: richardw at geoquip-rnd.demon.co.uk (richardw at geoquip-rnd.demon.co.uk) Date: Tue, 15 Nov 2005 14:14:03 +0000 Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 Message-ID: <17273.60715.533567.318277@titanic.geolog> Hi, I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) with Java 1.4.2_08. This has been working pretty smoothly. I've recently upgraded to Java 1.5.0_05 and the performance has gone through the floor. I've tried re-installing and upgrading to rxtx-2.0-7pre2 but this changes nothing. My app seems to be spending all its life in nativeDrain: "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) This doesn't make a lot of sense to me. Is this a known problem? If so, what's the solution ? Any help would be very much appreciated, Richard From tjarvi at qbang.org Tue Nov 15 10:04:53 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 15 Nov 2005 10:04:53 -0700 (MST) Subject: [Rxtx] Performance Problems with RXTX on Java 1.5 In-Reply-To: <17273.60715.533567.318277@titanic.geolog> References: <17273.60715.533567.318277@titanic.geolog> Message-ID: On Tue, 15 Nov 2005 richardw at geoquip-rnd.demon.co.uk wrote: > > Hi, > > I've been using the CommAPI version of rxtx (rxtx-2.0-7pre1) > for a while now on a Linux box (Slackware 9.1 - 2.6.10 kernel) > with Java 1.4.2_08. This has been working pretty smoothly. > > I've recently upgraded to Java 1.5.0_05 and the performance > has gone through the floor. I've tried re-installing and > upgrading to rxtx-2.0-7pre2 but this changes nothing. My > app seems to be spending all its life in nativeDrain: > > "RtDataRequestThread" daemon prio=1 tid=0x08626c60 nid=0x14c6 runnable [0xbc5ff000..0xbc5ff65c] > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1248) > at com.geoquip.drivers.common.MonitoredOutputStream.flush(MonitoredOutputStream.java:30) > > This doesn't make a lot of sense to me. Is this a known > problem? If so, what's the solution ? Any help would be > very much appreciated, > Hi Richard I'm not sure what is happening. It sounds like maybe the other side of the connection is not reading data fast enough? tcdrain() which is the native portion of the java flush() is called and will not return until all output is writting. It sounds like it is just waiting for the data to be writting. With Linux and true UARTs (/dev/ttyS*) you can simplify the nativeDrain() in SerialImp.c significantly to help you debug what is going on. Also see the comment regarding possible use of Thread.yield() in the comments above the function. JNIEXPORT jboolean JNICALL RXTXPort(nativeDrain)( JNIEnv *env, jobject jobj, jboolean interrupted ) { int fd = get_java_var( env, jobj,"fd","I" ); struct event_info_struct *eis = ( struct event_info_struct * ) get_java_var( env, jobj, "eis", "I" ); int result; result=tcdrain(fd); /* nonzero is a failure otherwise waits for all data to be sent */ if( result ) { /* exit with error */ throw_java_exception( env, IO_EXCEPTION, "nativeDrain", strerror( errno ) ); return( 1 ); } /* Send output buffer empty event if requested */ if( eis && eis->eventflags[SPE_OUTPUT_BUFFER_EMPTY] ) { send_event( eis, SPE_OUTPUT_BUFFER_EMPTY, 1 ); } return( 0 ); } From d.tonhofer at m-plify.com Wed Nov 16 10:18:05 2005 From: d.tonhofer at m-plify.com (David Tonhofer, m-plify S.A.) Date: Wed, 16 Nov 2005 18:18:05 +0100 Subject: [Rxtx] RXTX mail archives down? Message-ID: <69131B7C324A233C2B191D85@[192.168.1.7]> Hi Trent, I just wanted to ask whether the mail archives are still working? It looks like they stopped again, the one at stops at start-of-October and the one at stops at start-of-March (this is an old problem that you may possibly have classified under WONTFIX) Best regards, -- David From daniel.manzke at technik-emden.de Wed Nov 16 10:26:44 2005 From: daniel.manzke at technik-emden.de (daniel.manzke) Date: Wed, 16 Nov 2005 18:26:44 +0100 Subject: [Rxtx] Building the drivers step by step In-Reply-To: <17273.60715.533567.318277@titanic.geolog> Message-ID: <200511161725.jAGHPdHP024283@www.qbang.org> Hi there, I am testing around with RXTX and I got it to run under java 1.5 and under gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand and the same thing for GCJ... but always used the Drivers which would created by the make file... Can anybody tell me how to build them step by step? I built the gnu_io_*.h files with both gcjh and javah and included all directories.. but when I try For Example: gcc -I$Inculdes SerialImp.c -o SerialImp.o he throws... /usr/lib/crt1.o(.text+0x18): In function '_start': ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' My problem is... when I build them he can't link them... Thanks so far, Daniel From tjarvi at qbang.org Wed Nov 16 13:15:52 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:15:52 -0700 (MST) Subject: [Rxtx] RXTX mail archives down? In-Reply-To: <69131B7C324A233C2B191D85@[192.168.1.7]> References: <69131B7C324A233C2B191D85@[192.168.1.7]> Message-ID: On Wed, 16 Nov 2005, David Tonhofer, m-plify S.A. wrote: > Hi Trent, > > I just wanted to ask whether the mail archives are still working? > It looks like they stopped again, the one at > > > > stops at start-of-October > > and the one at > > > > stops at start-of-March (this is an old problem that you may > possibly have classified under WONTFIX) > I suspect I will have to take a look at this this weekend. I know the mail is being archived but suspect the scripts are not looking in the right place. I'll look into it. I had pulled the archives from the previous mail-list location but must not have setup the crontab right. From tjarvi at qbang.org Wed Nov 16 13:23:01 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 16 Nov 2005 13:23:01 -0700 (MST) Subject: [Rxtx] Building the drivers step by step In-Reply-To: <200511161725.jAGHPdHP024283@www.qbang.org> References: <200511161725.jAGHPdHP024283@www.qbang.org> Message-ID: On Wed, 16 Nov 2005, daniel.manzke wrote: > Hi there, > > I am testing around with RXTX and I got it to run under java 1.5 and under > gcc 4.0.2 with the gij ... I build the RXTXcomm.jar File for JAVA by Hand > and the same thing for GCJ... but always used the Drivers which would > created by the make file... > > Can anybody tell me how to build them step by step? I built the gnu_io_*.h > files with both gcjh and javah and included all directories.. but when I try > > For Example: > > gcc -I$Inculdes SerialImp.c -o SerialImp.o > > he throws... > > /usr/lib/crt1.o(.text+0x18): In function '_start': > ../sysdeps/i386/elf/start.S:115: undefined refernce to 'main' > > My problem is... when I build them he can't link them... > > Thanks so far, > > Daniel > The easiest way is going to be to use the makefile but catch the output in a typescript script make exit This will show all of the flags used while compiling. Especially the gcc flags. I believe it hides the javah command by placing a @ in front of that in the makefile but everything else should show exactly as needs to be done. From pbarthelemy at aim.com Fri Nov 18 00:28:22 2005 From: pbarthelemy at aim.com (Philippe Barthelemy) Date: Fri, 18 Nov 2005 08:28:22 +0100 Subject: [Rxtx] configuration GUI for rxtx ? Message-ID: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Hi, As part of the Swing test/demo application I mentionned earlier, I'm looking for a configuration UI for rxtx. something like a JFrame-based component with nice comboboxes, drop- down lists, etc... to set all the parameters of the serial ports. I've googled for this, and I did not find anything ( altough, I thought I have seen such a thing somewhere before ) Can anybody point me to such a configuration UI ? TIA, --Philippe From tjarvi at qbang.org Fri Nov 18 10:47:57 2005 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 18 Nov 2005 10:47:57 -0700 (MST) Subject: [Rxtx] configuration GUI for rxtx ? In-Reply-To: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> References: <4D36432E-C4AF-485E-B802-1090AAE51642@aim.com> Message-ID: On Fri, 18 Nov 2005, Philippe Barthelemy wrote: > Hi, > > As part of the Swing test/demo application I mentionned earlier, I'm looking > for a configuration UI for rxtx. > something like a JFrame-based component with nice comboboxes, drop-down > lists, etc... to set all the parameters of the serial ports. > > I've googled for this, and I did not find anything ( altough, I thought I > have seen such a thing somewhere before ) > > Can anybody point me to such a configuration UI ? > Hi Philippe, There has been talk of doing something like this but I've not heard of anything materializing yet. Many would like to do a swing type application that does much like the serial blackbox demo that comes with commAPI. The problems with blackbox include 1) It is crusty (umaintained?) AWT code. 2) There are limitations in the hard coded defaults that do not apply to rxtx. In fact they cause problems. 3) It can not be distributed with RXTX because of licensing issues. Some have thought about doing something in Swing which would be OK. The swing API is mature. Another interesting idea would be to do the same thing with SWT. This is a simple API which is implemented in Open Source. The SWT is not as large and complete as Swing but it would allow us to compile native applications for testing that would run on machines even if there are Java install problems. It is possibly something OS vendors could include with their distribution if it goes well enough. The native applications would simply be build using gcj. The GNU compiler. The code would work in Java as well. From lyon at docjava.com Sat Nov 19 03:18:43 2005 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Sat, 19 Nov 2005 05:18:43 -0500 Subject: [Rxtx] serial port Message-ID: Hi All, There has been some talk about creating a serial port gui. I suggest that we start by creating some business logic that serializes itself to the users preferences. This way, when the serial port starts, it can read its previous state. Something like the following might not be amiss: import gnu.io.SerialPort; import java.io.*; import java.util.prefs.Preferences; /** * A class that stores parameters for serial ports. */ public class SerialPortBean implements Serializable { private String portName; private int baudRate; private int flowControlIn; private int flowControlOut; private int databits; private int stopbits; private int parity; private static final String key = "serialPortBean"; DialBean db = DialBean.restore(); /** * restores the properties from the preference in the user root. */ /** * saves the properties to the Preferences of the userRoot */ public void save() { try { Preferences p = Preferences.userRoot(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); baos.close(); byte[] value = baos.toByteArray(); p.putByteArray(key, value); } catch (IOException e) { e.printStackTrace(); } } public static SerialPortBean restore() { try { Preferences p = Preferences.userRoot(); byte b [] = p.getByteArray(key, null); if (b == null) return new SerialPortBean(); ByteArrayInputStream bais = new ByteArrayInputStream(b); ObjectInputStream ois = new ObjectInputStream(bais); Object o = ois.readObject(); bais.close(); return (SerialPortBean) o; } catch (IOException e) { //e.printStackTrace(); } catch (ClassNotFoundException e) { //e.printStackTrace(); } return new SerialPortBean(); } /** * Default constructor. Sets parameters to no port, 9600 baud, no flow * control, 8 data bits, 1 stop bit, no parity. */ public SerialPortBean() { this( "", 9600, SerialPort.FLOWCONTROL_NONE, SerialPort.FLOWCONTROL_NONE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } /** * Paramaterized constructor. * * @param portName The name of the port. * @param baudRate The baud rate. * @param flowControlIn Type of flow control for receiving. * @param flowControlOut Type of flow control for sending. * @param databits The number of data bits. * @param stopbits The number of stop bits. * @param parity The type of parity. */ public SerialPortBean( String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity) { this.portName = portName; this.baudRate = baudRate; this.flowControlIn = flowControlIn; this.flowControlOut = flowControlOut; this.databits = databits; this.stopbits = stopbits; this.parity = parity; } /** * Sets port name. * * @param portName New port name. */ public void setPortName(String portName) { this.portName = portName; } /** * Gets port name. * * @return Current port name. */ public String getPortName() { return portName; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(int baudRate) { this.baudRate = baudRate; } /** * Sets baud rate. * * @param baudRate New baud rate. */ public void setBaudRate(String baudRate) { this.baudRate = Integer.parseInt(baudRate); } /** * Gets baud rate as an int. * * @return Current baud rate. */ public int getBaudRate() { return baudRate; } /** * Gets baud rate as a String. * * @return Current baud rate. */ public String getBaudRateString() { return Integer.toString(baudRate); } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(int flowControlIn) { this.flowControlIn = flowControlIn; } /** * Sets flow control for reading. * * @param flowControlIn New flow control for reading type. */ public void setFlowControlIn(String flowControlIn) { this.flowControlIn = stringToFlow(flowControlIn); } /** * Gets flow control for reading as an int. * * @return Current flow control type. */ public int getFlowControlIn() { return flowControlIn; } /** * Gets flow control for reading as a String. * * @return Current flow control type. */ public String getFlowControlInString() { return flowToString(flowControlIn); } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(int flowControlOut) { this.flowControlOut = flowControlOut; } /** * Sets flow control for writing. * * @param flowControlOut New flow control for writing type. */ public void setFlowControlOut(String flowControlOut) { this.flowControlOut = stringToFlow(flowControlOut); } /** * Gets flow control for writing as an int. * * @return Current flow control type. */ public int getFlowControlOut() { return flowControlOut; } /** * Gets flow control for writing as a String. * * @return Current flow control type. */ public String getFlowControlOutString() { return flowToString(flowControlOut); } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(int databits) { this.databits = databits; } /** * Sets data bits. * * @param databits New data bits setting. */ public void setDatabits(String databits) { if (databits.equals("5")) { this.databits = SerialPort.DATABITS_5; } if (databits.equals("6")) { this.databits = SerialPort.DATABITS_6; } if (databits.equals("7")) { this.databits = SerialPort.DATABITS_7; } if (databits.equals("8")) { this.databits = SerialPort.DATABITS_8; } } /** * Gets data bits as an int. * * @return Current data bits setting. */ public int getDatabits() { return databits; } /** * Gets data bits as a String. * * @return Current data bits setting. */ public String getDatabitsString() { switch (databits) { case SerialPort.DATABITS_5: return "5"; case SerialPort.DATABITS_6: return "6"; case SerialPort.DATABITS_7: return "7"; case SerialPort.DATABITS_8: return "8"; default: return "8"; } } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(int stopbits) { this.stopbits = stopbits; } /** * Sets stop bits. * * @param stopbits New stop bits setting. */ public void setStopbits(String stopbits) { if (stopbits.equals("1")) { this.stopbits = SerialPort.STOPBITS_1; } if (stopbits.equals("1.5")) { this.stopbits = SerialPort.STOPBITS_1_5; } if (stopbits.equals("2")) { this.stopbits = SerialPort.STOPBITS_2; } } /** * Gets stop bits setting as an int. * * @return Current stop bits setting. */ public int getStopbits() { return stopbits; } /** * Gets stop bits setting as a String. * * @return Current stop bits setting. */ public String getStopbitsString() { switch (stopbits) { case SerialPort.STOPBITS_1: return "1"; case SerialPort.STOPBITS_1_5: return "1.5"; case SerialPort.STOPBITS_2: return "2"; default: return "1"; } } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(int parity) { this.parity = parity; } /** * Sets parity setting. * * @param parity New parity setting. */ public void setParity(String parity) { if (parity.equals("None")) { this.parity = SerialPort.PARITY_NONE; } if (parity.equals("Even")) { this.parity = SerialPort.PARITY_EVEN; } if (parity.equals("Odd")) { this.parity = SerialPort.PARITY_ODD; } } /** * Gets parity setting as an int. * * @return Current parity setting. */ public int getParity() { return parity; } /** * Gets parity setting as a String. * * @return Current parity setting. */ public String getParityString() { switch (parity) { case SerialPort.PARITY_NONE: return "None"; case SerialPort.PARITY_EVEN: return "Even"; case SerialPort.PARITY_ODD: return "Odd"; default: return "None"; } } /** * Converts a String describing a flow control type to an * int type defined in SerialPort. * * @param flowControl A string describing a flow control * type. * @return An int describing a flow control type. */ private int stringToFlow(String flowControl) { if (flowControl.equals("None")) { return SerialPort.FLOWCONTROL_NONE; } if (flowControl.equals("Xon/Xoff Out")) { return SerialPort.FLOWCONTROL_XONXOFF_OUT; } if (flowControl.equals("Xon/Xoff In")) { return SerialPort.FLOWCONTROL_XONXOFF_IN; } if (flowControl.equals("RTS/CTS In")) { return SerialPort.FLOWCONTROL_RTSCTS_IN; } if (flowControl.equals("RTS/CTS Out")) { return SerialPort.FLOWCONTROL_RTSCTS_OUT; } return SerialPort.FLOWCONTROL_NONE; } /** * Converts an int describing a flow control type to a * String describing a flow control type. * * @param flowControl An